#define  _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
void mov(int* p, int n, int m)
{
	int i = 0;
	int* y = p;
	int a[10] = { 0 };
	int j = 0;
	while (i < (n - m))
	{
		a[j] = *p;
		p++;
		i++;
		j++;
	}
	i = 0;
	while (i < m)
	{
		*y = *p;
		y++;
		p++;
		i++;
	}
	i = 0;
	while (i < (n - m))
	{
		*y = a[i];
		y++;
		i++;
	}
}
int main()
{
	int n, m, x[100];
	int i = 0;
	scanf("%d %d", &n, &m);
	for (i = 0; i < n; i++)
	{
		scanf("%d", & x[i]);
	}
	mov(x, n, m);
	printf("After move:");
	for (i = 0; i < n; i++)
	{
		printf(" %d", x[i]);		
	}

	return 0;
}